ccR.Mage = {
	Frost_Nova =
	function()
		if ccR.Player.Has.Spell(FROST_NOVA) 
		and ccR.Spell.Is.Ready(FROST_NOVA)
		then 
			ccR.Cast.Spell(FROST_NOVA) 
		end
	end,
	Slow_Fall =
	function()
		if ccR.Player.FallingTime() >= ccR.Var("Slow_Fall_Time") 
		and ccR.Player.Is.Falling()
		and not ccR.Player.Has.Buff(SLOW_FALL)

		then
			ccR.Cast.Spell(SLOW_FALL, "player") 
		end		
	end,
}
setmetatable(ccR.Mage,ccR)
ccR.Mage.Feature = {
	Remove_Curse = 
	function()
		if ccR.Spell.Is.Ready(REMOVE_CURSE) then
			for i = 1, 40 do 
				local name, _, _, _, debuffType = UnitDebuff("player", i)
				if name == nil then
					break
				else
					if debuffType == "Curse" then
						ccR.Cast.Spell(REMOVE_CURSE, "player")
						return
					end
				end
			end
		end
	end,
	Counterspell = 
	function()
		if ccR.Spell.Is.Ready(COUNTERSPELL) then
			for x = 1, # ccR_Enemies do
				local vUnit = ccR_Enemies[x]
				if ccR.Unit.Exists(vUnit)
				and (
						(ccR.Unit.Is.Casting(vUnit) and ccR.Unit.Has.LeftOnCast(vUnit,1))
						or
						ccR.Unit.Is.Channeling(vUnit)
					)
				and ccR.Unit.Is.Interuptable(vUnit)
				and ccR.Spell.CanAttack(COUNTERSPELL, vUnit)
				then
					ccR.StopCasting(0.5)
					ccR.Cast.AF.Attack(COUNTERSPELL, vUnit)
				end
			end
		end
	end,
	Arcane_Brilliance = 
	function()
		if not ccR.Player.Has.Buff(ARCANE_BRILLIANCE)
		and not ccR.Player.Has.Buff(DALARAN_BRILLIANCE)
		and not ccR.Player.Has.Buff(DARK_INTENT)
		and not ccR.Player.Has.Buff(STILL_WATER)
		and ccR.Spell.Is.Ready(ARCANE_BRILLIANCE)
		then
			ccR.Cast.Spell(ARCANE_BRILLIANCE)
		end
	end,
	Polymorph = 
	function(unit)
		if ccR.Unit.Exists(unit)
		and ccR.Unit.Is.Alive(unit)
		and not ccR.Unit.Has.MyDebuff(unit, POLYMORPH)
		and ccR.Spell.CanAttack(POLYMORPH, unit)
		and (not ccR.Player.Is.Moving() or ccR.Player.Has.Buff(ICE_FLOES))
		and ccR.Target.GUID() ~= ccR.Unit.GUID(unit)
		then
			ccR.Cast.Attack(POLYMORPH, unit)
		end	
	end,
}
setmetatable(ccR.Mage.Feature, ccR.Mage)